﻿<UserControl x:Class="SubtitleTools.Shell.DetectEncodingView"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:Behaviors="clr-namespace:SubtitleTools.Common.Behaviors;assembly=SubtitleTools.Common"
			 Background="#FF393939" FontFamily="Tahoma"             
			 mc:Ignorable="d" Name="ThisDetectEncodingView"
			 d:DesignHeight="300" d:DesignWidth="300">
	<Grid Name="LayoutRoot">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Grid Grid.Row="0">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<GroupBox Margin="3" Header="Convert Encoding" Grid.Column="1">
				<Grid Margin="3">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="auto" />
						<ColumnDefinition Width="auto" />
						<ColumnDefinition Width="auto" />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition />
						<RowDefinition />
					</Grid.RowDefinitions>
					<TextBlock Text="From: " Grid.Row="0" Grid.Column="0" Margin="3" VerticalAlignment="Center" />
					<ComboBox Width="150" Grid.Column="1" Grid.Row="0"
							 ItemsSource="{Binding EncodingsInfData}"
							 SelectedValue="{Binding SelectedEncoding, Mode=TwoWay}"
							 Margin="3" VerticalAlignment="Center">
						<ComboBox.ItemTemplate>
							<DataTemplate>
								<TextBlock Text="{Binding Name}" />
							</DataTemplate>
						</ComboBox.ItemTemplate>
					</ComboBox>
					<TextBlock Text="To: UTF-8" Grid.Column="2" Grid.Row="0"
							   Margin="3" VerticalAlignment="Center"/>

					<ListBox x:Name="RadioButtonList" 
							 Grid.Row="1"
							 Grid.Column="0"
							 Grid.ColumnSpan="3"
							 IsSynchronizedWithCurrentItem="True"
							 SelectedIndex="{Binding AddIndex}"
							 BorderThickness="0" Background="{x:Null}">       
						<ListBoxItem IsSelected="{Binding IsChecked, ElementName=RadioButton1, Mode=OneWay}">
							<RadioButton Margin="2" x:Name="RadioButton1" GroupName="Group" VerticalAlignment="Center">Opened file</RadioButton>
						</ListBoxItem>
						<ListBoxItem IsSelected="{Binding IsChecked, ElementName=RadioButton2, Mode=OneWay}">
							<StackPanel Orientation="Horizontal">
								<RadioButton Margin="2" x:Name="RadioButton2" GroupName="Group" VerticalAlignment="Center">This folder:</RadioButton>
								<TextBox Margin="2" Width="150" IsReadOnly="True" 
										 Text="{Binding FolderPath, Mode=TwoWay}"
										 VerticalAlignment="Center" />
								<Button Margin="2" Content="..." ToolTip="Select folder" 
										Width="25" VerticalAlignment="Center" Height="24" >
									<i:Interaction.Triggers>
										<i:EventTrigger EventName="Click">
											<Behaviors:FolderBrowserDialogBehavior
													FolderBrowserDescription="Select a folder"
													FolderBrowserDialogResultCommand="{Binding FolderPath, Mode=TwoWay}"
												/>
										</i:EventTrigger>
									</i:Interaction.Triggers>
								</Button>
							</StackPanel>
						</ListBoxItem>
						<ListBox.ItemContainerStyle>
							<Style TargetType="{x:Type ListBoxItem}">
								<Setter Property="Template">
									<Setter.Value>
										<ControlTemplate TargetType="{x:Type ListBoxItem}">
											<ContentPresenter/>
										</ControlTemplate>
									</Setter.Value>
								</Setter>
							</Style>
						</ListBox.ItemContainerStyle>
					</ListBox>
				</Grid>
			</GroupBox>
		</Grid>
		<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
			<Button Content="Apply" 
				Command="{Binding DoConvertEncoding}"
				CommandParameter="{Binding ElementName=ThisDetectEncodingView, Path=FilePath}"
				Margin="3" Height="25" Width="60" />
			<Button Content="Cancel" 
					Command="{Binding DoCloseConvertEncodingView}"
					Margin="3" Width="60"/>
		</StackPanel>
	</Grid>
</UserControl>
